package com.chengfei.service;

import com.chengfei.rabbitmq.RabbitMQConfiguration;
import lombok.extern.log4j.Log4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author chengfei cheng.fei@chinaott.onaliyun.com
 **/
@Service
@Log4j
public class Receiver {
    @Autowired
    private AmqpTemplate amqpTemplate;
    @RabbitListener(queues = RabbitMQConfiguration.QUEUE_NAME)
    public void receiveMessage(String message){
        log.info("Received <" + message + ">");
    }
    @RabbitListener(queues = RabbitMQConfiguration.TOPIC_QUEUE_NAME1)
    public void receiveTopic1Message(String message){
        log.info("Received topic1<" + message + ">");
    }
    @RabbitListener(queues = RabbitMQConfiguration.TOPIC_QUEUE_NAME2)
    public void receiveTopic2Message(String message){
        log.info("Received topic2<" + message + ">");
    }
}
